var current_url = location.href;
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
    console.log("shouji");
    if (current_url.indexOf("wap") == -1) {
        var mobile_url = current_url.replace('\/web', '\/wap');
        location.href = mobile_url;
    }
} else {
    if (current_url.indexOf("web") == -1) {
        var pc_url = current_url.replace('\/wap', '\/web');
        location.href = pc_url;
    }
}